package org.aplikator.server.descriptor;

import org.aplikator.client.descriptor.BinaryFieldDTO;
import org.aplikator.client.descriptor.EntityDTO;
import org.aplikator.client.descriptor.WidgetDTO;
import org.aplikator.server.Context;
import org.aplikator.shared.data.BinaryData;

public class BinaryField implements Widget, HasProperty<BinaryData> {

    private Property<BinaryData> property;

    public BinaryField(Property<BinaryData> property) {
        this.property = property;
    }

    public Property<BinaryData> getProperty() {
        return property;
    }

    public WidgetDTO getWidgetDescriptor(Context ctx) {
        BinaryFieldDTO desc = new BinaryFieldDTO(property.clientClone(ctx), new EntityDTO( property.getEntity().getId(), property.getEntity().getLocalizedName(ctx)));
        return desc;
    }

    public void registerProperties(Form form) {
        //form.addProperty(property);
    }
}
